<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/html5.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/respond.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/PIE_IE678.js"></script>
    <![endif]-->
    <link href="__PUBLIC__/Admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/Admin/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__PUBLIC__/Admin/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>新增插件</title>
</head>
<body>
<div class="pd-20">
    <form action="__URL__/plus_add" method="post" enctype="multipart/form-data" class="form form-horizontal" id="form-article-add">
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>插件标题：</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" value="{$plus['title']}" placeholder="" id="" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>插件名称：</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" value="{$plus['name']}" placeholder="" id="" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">插件类别：</label>
            <div class="formControls col-10">
                <select name="type">
                    <foreach name="type" item="v">
                        <option value="{$v['id']}" <if condition="$plus['type'] eq $v['id']"> selected = "selected" </if>>{$v['name']}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">插件关键词：</label>
            <div class="formControls col-10">
                <input type="text" class="input-text" value="{$plus['keyword']}" placeholder="" id="" name="keywords">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">缩略图：</label>
            <div class="formControls col-10">
                <div class="uploader-thum-container">
                    <div id="fileList" class="uploader-list">
                        <if condition="$viewdata['cover'] neq ''">
                            <div class="file-item-row">
                                <img src="{$plus['thumb']}" alt="">
                            </div>
                        </if>
                    </div>
                    <div id="filePicker" class="filePicker">选择图片 <input type="file" class="filepicker-btn" name="file_pic" onchange="filepicker(this)"></div>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">插件附件：</label>
            <div class="formControls col-10">
                <div class="zipShow">
                    <i></i>
                    <span></span>
                </div>
                <div class="lrc_select">
                    <input type="file" name="zip" onchange="selectZip(this)">
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2">插件简介：</label>
            <div class="formControls col-10">
                <script id="editor" name="description" type="text/plain" style="width:100%;height:400px;">{$plus['description']|html_entity_decode=###}</script>
            </div>
        </div>
        <input type="hidden" name="id" value="{$plus['id']}">
        <div class="row cl">
            <div class="col-10 col-offset-2">
                <button onClick="article_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
                <button onClick="article_save();" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存草稿</button>
                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="__PUBLIC__/Admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/H-ui.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/baseCommon.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        var ue = UE.getEditor('editor');
    });
    filelist = document.getElementById("fileList");
    // 图片选择之后预览
    function filepicker(obj){
        var vale = obj.value;
        if(is_allowType(subfix(vale))){
            var view = document.createElement('div');
            view.className = 'file-item-row';
            filelist.innerHTML = '';
            filelist.appendChild(view);
            preview(obj,view);
        }else{
            alert('请选择图片文件');
        }
    }

    // 选择歌词文件
    function selectZip(file){
        var Filev = file.value;
        var Filename = Filev.substring(Filev.lastIndexOf('\\')+1,Filev.lastIndexOf('.'));
        var FileType = Filev.substring(Filev.lastIndexOf('.')+1);
        var LrcReg = /zip|rar|ZIP|RAR/;
        if(!LrcReg.test(FileType)){
            alert("文件不是压缩文件");
            return ;
        }
        var zipShow = document.getElementsByClassName('zipShow')[0];
        var zipShowSpan = zipShow.getElementsByTagName('span')[0];
        zipShow.style.display = 'inline-block';
        zipShowSpan.innerHTML = Filename;
    }

    file_ = document.getElementsByClassName('file_')[0];
    // 文件选择之后预览
    function fileSelect(obj){
        var is_atta = document.getElementById('is_atta');
        if(!is_atta.checked){
            alert("请勾上允许附件");
            return;
        }
        var vale = obj.value;
        var type = subfix(vale);
        var name = vale.substring(vale.lastIndexOf("\\")+1);
        var reg = /zip|mp4|mp3/;
        if(reg.test(type)){
            file_.innerHTML = "<b class='my-iconfont "+type+"'></b>已选择:"+name;
        }else{
            alert('请选择文件');
        }
    }

</script>
</body>
</html>